// source --> https://www.legolfacademy.de/wp-content/themes/nrWpOOP-child/assets/js/privacy-v2.js window.NrCookieHandler = { config: { withbackground: true, primarycolor: '#002849', cookietypes: { essential: 'essential', statistics: 'statistics', marketing: 'marketing', externmedia: 'externmedia' } }, text: { de: { title: 'Datenschutzeinstellungen', body: 'Wir nutzen Cookies auf unserer Website. Einige von ihnen sind essenziell, während
andere uns helfen, diese Website und Ihre Erfahrung zu verbessern.', selectors: { essential: 'Essentiell', statistics: 'Statistiken', marketing: 'Marketing', externmedia: 'Externe Medien' }, buttons: { acceptall: 'Alle akzeptieren', acceptselection: 'Auswahl akzeptieren', acceptessential: 'Nur essentielle Cookies akzeptieren' }, links: { privacypolicy: { href: '/datenschutzerklaerung', name: 'Datenschutzerklärung' }, imprint: { href: '/impressum', name: 'Impressum' } } } }, lang: function (language, textselector) { textselector = textselector.split('.'); var res = this.text[language]; for (var i = 0; i < textselector.length; i++) { res = res[textselector[i]]; } return res; }, queue: function (cookieType, queuedScript) { document.addEventListener("DOMContentLoaded", function () { if (NrCookieHandler.isCookieTypeAllowed(cookieType)) { NrCookieHandler.writeScript(queuedScript); return; } window.addEventListener('NrCookieHandler', function (event) { if (event.detail.name === cookieType && event.detail.status === true) { NrCookieHandler.writeScript(queuedScript); } }); }); }, writeScript(script) { if (script.indexOf('http') !== 0) { eval(script); return; } var scriptHolder = document.querySelector('#nrPrivacyScriptsHolder'); var scriptTag = document.createElement('script'); scriptTag.type = 'text/javascript'; scriptTag.charset = 'utf-8'; scriptTag.id = 'testing'; scriptTag.defer = true; scriptTag.async = true; scriptTag.src = script; scriptHolder.appendChild(scriptTag); }, storeUserSelection: function (cookieSettings) { localStorage.setItem('cookies_allowed_' + cookieSettings.name, cookieSettings.status ? 'true' : 'false'); if (cookieSettings.status) { window.dispatchEvent( new CustomEvent('NrCookieHandler', {detail: cookieSettings}) ); } }, acceptall: function () { for (var prop in this.config.cookietypes) { if (Object.prototype.hasOwnProperty.call(this.config.cookietypes, prop)) { this.storeUserSelection({ name: prop, status: true }); } } this.hide(); }, acceptselection: function () { var selectors = document.querySelectorAll('.nr-privacy-modal-box-v2 .inner .selectors .selector input'); for (var i = 0; i < selectors.length; i++) { if (selectors[i].checked) { this.storeUserSelection({ name: selectors[i].name, status: true }); } } this.hide(); }, acceptessential: function () { this.storeUserSelection({ name: this.config.cookietypes.essential, status: true }); this.hide(); }, isCookieTypeAllowed: function (name) { return localStorage.getItem('cookies_allowed_' + name) === 'true'; }, init: function () { var nrPrivacyScriptsHolder = document.createElement('div'); nrPrivacyScriptsHolder.id = 'nrPrivacyScriptsHolder'; document.body.appendChild(nrPrivacyScriptsHolder); if (!this.isCookieTypeAllowed(this.config.cookietypes.essential)) { this.show(); } }, show: function () { document.querySelector('.nr-privacy-modal-box-v2').classList.remove('hidden'); }, hide: function () { document.querySelector('.nr-privacy-modal-box-v2').classList.add('hidden'); } }; document.addEventListener("DOMContentLoaded", function () { var language = 'de'; var modalMarkup = '' + '' + '' + ''; var nrPrivacyModal = document.createElement('div'); nrPrivacyModal.innerHTML = modalMarkup; document.body.appendChild(nrPrivacyModal); NrCookieHandler.init(); }); // NrCookieHandler.queue('essential', 'console.log("here we go");'); // NrCookieHandler.queue('essential', 'https://www.wirsind1991.de/wp-content/themes/1991/js/privacy-v2.js');